package br.curso.senac.entity;

import java.io.Serializable;
import java.util.GregorianCalendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

@Entity
@Table(name="notafiscal")
public class NotaFiscal implements Serializable {
	
	private static final long serialVersionUID = 378432676483667794L;

	@Id
	@Column(name="id")
	@SequenceGenerator(name = "notafiscal", sequenceName = "NotaFiscal_id_seq")		
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="notafiscal")
	private Integer id;
	
	@Column(name="numero")
	private String numero;
	
	@Column(name="chaveAcesso")
	private String chaveAcesso;
	
	@Column(name="dataEmissao")
	private GregorianCalendar dataEmissao;
	
	@Column(name="valorTotal")
	private Double valorTotal;
	
	@OneToOne(fetch=FetchType.LAZY)
	@JoinColumn(name="cliente_id")
	private Cliente cliente;
	
	@ManyToOne
	@JoinColumn(name="idItem")
	private Item item;

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNumero() {
		return numero;
	}

	public void setNumero(String numero) {
		this.numero = numero;
	}

	public String getChaveAcesso() {
		return chaveAcesso;
	}

	public void setChaveAcesso(String chaveAcesso) {
		this.chaveAcesso = chaveAcesso;
	}

	public GregorianCalendar getDataEmissao() {
		return dataEmissao;
	}

	public void setDataEmissao(GregorianCalendar dataEmissao) {
		this.dataEmissao = dataEmissao;
	}

	public Double getValorTotal() {
		return valorTotal;
	}

	public void setValorTotal(Double valorTotal) {
		this.valorTotal = valorTotal;
	}

	public Cliente getCliente() {
		return cliente;
	}

	public void setCliente(Cliente cliente) {
		this.cliente = cliente;
	}

	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}
			
	
}
